<?php
include_once '../classes/dao.php';
include_once '../classes/sugestoes.php';

$dao = new DAO();

if (!isset($_REQUEST["term"])) {
	exit;
}

$consulta = $_REQUEST["term"];

$de_quem_eh_array = $dao->consulta_de_quem_eh($consulta);

$sugestoes = new Sugestoes();
foreach ($de_quem_eh_array as $indice => $de_quem_eh) {
	$sugestoes->adicionar_sugestao($indice, $de_quem_eh);
}

echo $sugestoes->get_json();
?>